home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / abstract.bst < prev    next >
Text File  |  1992-07-19  |  24KB  |  1,341 lines

  1. % BibTeX bibliography style `abstract' by David Kotz
  2. %    modifed from
  3. % BibTeX standard bibliography style `alpha'
  4.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  5.     % Copyright (C) 1985, all rights reserved.
  6.     % Copying of this file is authorized only if either
  7.     % (1) you make absolutely no changes to your copy, including name, or
  8.     % (2) if you do make changes, you name it something other than
  9.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  10.     % This restriction helps ensure that all standard styles are identical.
  11.     % The file btxbst.doc has the documentation for this style.
  12.  
  13. % DFK added abstract, comment, keyword
  14. ENTRY
  15.   { abstract
  16.     address
  17.     author
  18.     booktitle
  19.     chapter
  20.     comment
  21.     edition
  22.     editor
  23.     howpublished
  24.     institution
  25.     journal
  26.     key
  27.     keyword
  28.     month
  29.     note
  30.     number
  31.     organization
  32.     pages
  33.     publisher
  34.     school
  35.     series
  36.     title
  37.     type
  38.     volume
  39.     year
  40.   }
  41.   {}
  42.   { label extra.label sort.label }
  43.  
  44. % DFK added after.quote to signify end of something not needing period
  45. INTEGERS { output.state before.all mid.sentence after.sentence after.block after.quote}
  46.  
  47. % DFk added after.quote 
  48. FUNCTION {init.state.consts}
  49. { #0 'before.all :=
  50.   #1 'mid.sentence :=
  51.   #2 'after.sentence :=
  52.   #3 'after.block :=
  53.   #4 'after.quote :=
  54. }
  55.  
  56. STRINGS { s t }
  57.  
  58. % DFK added after.quote handling so no period is printed after quotes
  59. FUNCTION {output.nonnull}
  60. { 's :=
  61.   output.state after.quote =
  62.     { write$
  63.       newline$
  64.       "\newblock " write$
  65.     }
  66.   { output.state mid.sentence =
  67.     { ", " * write$ }
  68.     { output.state after.block =
  69.     { add.period$ write$
  70.       newline$
  71.       "\newblock " write$
  72.     }
  73.     { output.state before.all =
  74.          'write$
  75.          { add.period$ " " * write$ }
  76.         if$
  77.     }
  78.       if$
  79.       mid.sentence 'output.state :=
  80.     }
  81.   if$
  82.   }
  83.   if$
  84.   s
  85. }
  86.  
  87. FUNCTION {output}
  88. { duplicate$ empty$
  89.     'pop$
  90.     'output.nonnull
  91.   if$
  92. }
  93.  
  94. % DFK added, variant of output
  95. FUNCTION {output.quote}
  96. { duplicate$ empty$
  97.     'pop$
  98.     { output.nonnull 
  99.      after.quote 'output.state :=}
  100.   if$
  101. }
  102.  
  103. FUNCTION {output.check}
  104. { 't :=
  105.   duplicate$ empty$
  106.     { pop$ "empty " t * " in " * cite$ * warning$ }
  107.     'output.nonnull
  108.   if$
  109. }
  110.  
  111. % DFK changed to use cite$ for the label
  112. FUNCTION {output.bibitem}
  113. { newline$
  114.   "\bibitem[" write$
  115.   cite$ write$
  116.   "]{" write$
  117.   cite$ write$
  118.   "}" write$
  119.   newline$
  120.   ""
  121.   before.all 'output.state :=
  122. }
  123.  
  124. % DFK changed to not put period when after.quote
  125. FUNCTION {fin.entry}
  126. { output.state after.quote =
  127.    'skip$
  128.    'add.period$
  129.   if$
  130.   write$
  131.   newline$
  132. }
  133.  
  134. FUNCTION {new.block}
  135. { output.state before.all =
  136.     'skip$
  137.     { after.block 'output.state := }
  138.   if$
  139. }
  140.  
  141. FUNCTION {new.sentence}
  142. { output.state after.block =
  143.     'skip$
  144.     { output.state before.all =
  145.     'skip$
  146.     { after.sentence 'output.state := }
  147.       if$
  148.     }
  149.   if$
  150. }
  151.  
  152. FUNCTION {not}
  153. {   { #0 }
  154.     { #1 }
  155.   if$
  156. }
  157.  
  158. FUNCTION {and}
  159. {   'skip$
  160.     { pop$ #0 }
  161.   if$
  162. }
  163.  
  164. FUNCTION {or}
  165. {   { pop$ #1 }
  166.     'skip$
  167.   if$
  168. }
  169.  
  170. FUNCTION {new.block.checka}
  171. { empty$
  172.     'skip$
  173.     'new.block
  174.   if$
  175. }
  176.  
  177. FUNCTION {new.block.checkb}
  178. { empty$
  179.   swap$ empty$
  180.   and
  181.     'skip$
  182.     'new.block
  183.   if$
  184. }
  185.  
  186. FUNCTION {new.sentence.checka}
  187. { empty$
  188.     'skip$
  189.     'new.sentence
  190.   if$
  191. }
  192.  
  193. FUNCTION {new.sentence.checkb}
  194. { empty$
  195.   swap$ empty$
  196.   and
  197.     'skip$
  198.     'new.sentence
  199.   if$
  200. }
  201.  
  202. FUNCTION {field.or.null}
  203. { duplicate$ empty$
  204.     { pop$ "" }
  205.     'skip$
  206.   if$
  207. }
  208.  
  209. FUNCTION {emphasize}
  210. { duplicate$ empty$
  211.     { pop$ "" }
  212.     { "{\em " swap$ * "}" * }
  213.   if$
  214. }
  215.  
  216. INTEGERS { nameptr namesleft numnames }
  217.  
  218. FUNCTION {format.names}
  219. { 's :=
  220.   #1 'nameptr :=
  221.   s num.names$ 'numnames :=
  222.   numnames 'namesleft :=
  223.     { namesleft #0 > }
  224.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  225.       nameptr #1 >
  226.     { namesleft #1 >
  227.         { ", " * t * }
  228.         { numnames #2 >
  229.         { "," * }
  230.         'skip$
  231.           if$
  232.           t "others" =
  233.         { " et~al." * }
  234.         { " and " * t * }
  235.           if$
  236.         }
  237.       if$
  238.     }
  239.     't
  240.       if$
  241.       nameptr #1 + 'nameptr :=
  242.       namesleft #1 - 'namesleft :=
  243.     }
  244.   while$
  245. }
  246.  
  247. FUNCTION {format.authors}
  248. { author empty$
  249.     { "" }
  250.     { author format.names }
  251.   if$
  252. }
  253.  
  254. FUNCTION {format.editors}
  255. { editor empty$
  256.     { "" }
  257.     { editor format.names
  258.       editor num.names$ #1 >
  259.     { ", editors" * }
  260.     { ", editor" * }
  261.       if$
  262.     }
  263.   if$
  264. }
  265.  
  266. FUNCTION {format.title}
  267. { title empty$
  268.     { "" }
  269.     { title "t" change.case$ }
  270.   if$
  271. }
  272.  
  273. FUNCTION {n.dashify}
  274. { 't :=
  275.   ""
  276.     { t empty$ not }
  277.     { t #1 #1 substring$ "-" =
  278.     { t #1 #2 substring$ "--" = not
  279.         { "--" *
  280.           t #2 global.max$ substring$ 't :=
  281.         }
  282.         {   { t #1 #1 substring$ "-" = }
  283.         { "-" *
  284.           t #2 global.max$ substring$ 't :=
  285.         }
  286.           while$
  287.         }
  288.       if$
  289.     }
  290.     { t #1 #1 substring$ *
  291.       t #2 global.max$ substring$ 't :=
  292.     }
  293.       if$
  294.     }
  295.   while$
  296. }
  297.  
  298. FUNCTION {format.date}
  299. { year empty$
  300.     { month empty$
  301.     { "" }
  302.     { "there's a month but no year in " cite$ * warning$
  303.       month
  304.     }
  305.       if$
  306.     }
  307.     { month empty$
  308.     'year
  309.     { month " " * year * }
  310.       if$
  311.     }
  312.   if$
  313. }
  314.  
  315. FUNCTION {format.btitle}
  316. { title emphasize
  317. }
  318.  
  319. FUNCTION {tie.or.space.connect}
  320. { duplicate$ text.length$ #3 <
  321.     { "~" }
  322.     { " " }
  323.   if$
  324.   swap$ * *
  325. }
  326.  
  327. FUNCTION {either.or.check}
  328. { empty$
  329.     'pop$
  330.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  331.   if$
  332. }
  333.  
  334. FUNCTION {format.bvolume}
  335. { volume empty$
  336.     { "" }
  337.     { "volume" volume tie.or.space.connect
  338.       series empty$
  339.     'skip$
  340.     { " of " * series emphasize * }
  341.       if$
  342.       "volume and number" number either.or.check
  343.     }
  344.   if$
  345. }
  346.  
  347. FUNCTION {format.number.series}
  348. { volume empty$
  349.     { number empty$
  350.     { series field.or.null }
  351.     { output.state mid.sentence =
  352.         { "number" }
  353.         { "Number" }
  354.       if$
  355.       number tie.or.space.connect
  356.       series empty$
  357.         { "there's a number but no series in " cite$ * warning$ }
  358.         { " in " * series * }
  359.       if$
  360.     }
  361.       if$
  362.     }
  363.     { "" }
  364.   if$
  365. }
  366.  
  367. FUNCTION {format.edition}
  368. { edition empty$
  369.     { "" }
  370.     { output.state mid.sentence =
  371.     { edition "l" change.case$ " edition" * }
  372.     { edition "t" change.case$ " edition" * }
  373.       if$
  374.     }
  375.   if$
  376. }
  377.  
  378. INTEGERS { multiresult }
  379.  
  380. FUNCTION {multi.page.check}
  381. { 't :=
  382.   #0 'multiresult :=
  383.     { multiresult not
  384.       t empty$ not
  385.       and
  386.     }
  387.     { t #1 #1 substring$
  388.       duplicate$ "-" =
  389.       swap$ duplicate$ "," =
  390.       swap$ "+" =
  391.       or or
  392.     { #1 'multiresult := }
  393.     { t #2 global.max$ substring$ 't := }
  394.       if$
  395.     }
  396.   while$
  397.   multiresult
  398. }
  399.  
  400. FUNCTION {format.pages}
  401. { pages empty$
  402.     { "" }
  403.     { pages multi.page.check
  404.     { "pages" pages n.dashify tie.or.space.connect }
  405.     { "page" pages tie.or.space.connect }
  406.       if$
  407.     }
  408.   if$
  409. }
  410.  
  411. FUNCTION {format.vol.num.pages}
  412. { volume field.or.null
  413.   number empty$
  414.     'skip$
  415.     { "(" number * ")" * *
  416.       volume empty$
  417.     { "there's a number but no volume in " cite$ * warning$ }
  418.     'skip$
  419.       if$
  420.     }
  421.   if$
  422.   pages empty$
  423.     'skip$
  424.     { duplicate$ empty$
  425.     { pop$ format.pages }
  426.     { ":" * pages n.dashify * }
  427.       if$
  428.     }
  429.   if$
  430. }
  431.  
  432. FUNCTION {format.chapter.pages}
  433. { chapter empty$
  434.     'format.pages
  435.     { type empty$
  436.     { "chapter" }
  437.     { type "l" change.case$ }
  438.       if$
  439.       chapter tie.or.space.connect
  440.       pages empty$
  441.     'skip$
  442.     { ", " * format.pages * }
  443.       if$
  444.     }
  445.   if$
  446. }
  447.  
  448. FUNCTION {format.in.ed.booktitle}
  449. { booktitle empty$
  450.     { "" }
  451.     { editor empty$
  452.     { "In " booktitle emphasize * }
  453.     { "In " format.editors * ", " * booktitle emphasize * }
  454.       if$
  455.     }
  456.   if$
  457. }
  458.  
  459. FUNCTION {empty.misc.check}
  460. { author empty$ title empty$ howpublished empty$
  461.   month empty$ year empty$ note empty$
  462.   and and and and and
  463.   key empty$ not and
  464.     { "all relevant fields are empty in " cite$ * warning$ }
  465.     'skip$
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.thesis.type}
  470. { type empty$
  471.     'skip$
  472.     { pop$
  473.       type "t" change.case$
  474.     }
  475.   if$
  476. }
  477.  
  478. FUNCTION {format.tr.number}
  479. { type empty$
  480.     { "Technical Report" }
  481.     'type
  482.   if$
  483.   number empty$
  484.     { "t" change.case$ }
  485.     { number tie.or.space.connect }
  486.   if$
  487. }
  488.  
  489. FUNCTION {format.article.crossref}
  490. { key empty$
  491.     { journal empty$
  492.     { "need key or journal for " cite$ * " to crossref " * crossref *
  493.       warning$
  494.       ""
  495.     }
  496.     { "In {\em " journal * "\/}" * }
  497.       if$
  498.     }
  499.     { "In " key * }
  500.   if$
  501.   " \cite{" * crossref * "}" *
  502. }
  503.  
  504. FUNCTION {format.crossref.editor}
  505. { editor #1 "{vv~}{ll}" format.name$
  506.   editor num.names$ duplicate$
  507.   #2 >
  508.     { pop$ " et~al." * }
  509.     { #2 <
  510.     'skip$
  511.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  512.         { " et~al." * }
  513.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  514.       if$
  515.     }
  516.       if$
  517.     }
  518.   if$
  519. }
  520.  
  521. FUNCTION {format.book.crossref}
  522. { volume empty$
  523.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  524.       "In "
  525.     }
  526.     { "Volume" volume tie.or.space.connect
  527.       " of " *
  528.     }
  529.   if$
  530.   editor empty$
  531.   editor field.or.null author field.or.null =
  532.   or
  533.     { key empty$
  534.     { series empty$
  535.         { "need editor, key, or series for " cite$ * " to crossref " *
  536.           crossref * warning$
  537.           "" *
  538.         }
  539.         { "{\em " * series * "\/}" * }
  540.       if$
  541.     }
  542.     { key * }
  543.       if$
  544.     }
  545.     { format.crossref.editor * }
  546.   if$
  547.   " \cite{" * crossref * "}" *
  548. }
  549.  
  550. FUNCTION {format.incoll.inproc.crossref}
  551. { editor empty$
  552.   editor field.or.null author field.or.null =
  553.   or
  554.     { key empty$
  555.     { booktitle empty$
  556.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  557.           crossref * warning$
  558.           ""
  559.         }
  560.         { "In {\em " booktitle * "\/}" * }
  561.       if$
  562.     }
  563.     { "In " key * }
  564.       if$
  565.     }
  566.     { "In " format.crossref.editor * }
  567.   if$
  568.   " \cite{" * crossref * "}" *
  569. }
  570.  
  571. % DFK added
  572. FUNCTION {format.abstract}
  573. { abstract empty$
  574.     { "" }
  575.     { "\begin{quote} {\bf Abstract:} " abstract * " \end{quote}" *}
  576.   if$
  577. }
  578.  
  579. % DFK added
  580. FUNCTION {format.keyword}
  581. { keyword empty$
  582.     { "" }
  583.     { "\begin{quote} {\bf Keyword:} " keyword * " \end{quote}" *}
  584.   if$
  585. }
  586.  
  587. % DFK added
  588. FUNCTION {format.comment}
  589. { comment empty$
  590.     { "" }
  591.     { "\begin{quote} {\bf Comment:} " comment * " \end{quote}" *}
  592.   if$
  593. }
  594.  
  595. % DFK added
  596. FUNCTION {dfk.stuff}
  597. { new.block
  598.   format.abstract output.quote
  599. %  new.block
  600.   format.keyword output.quote
  601. %  new.block
  602.   format.comment output.quote
  603. }
  604.  
  605. % DFK: added a call to dfk.stuff in all entry-type functions below
  606.  
  607. FUNCTION {article}
  608. { output.bibitem
  609.   format.authors "author" output.check
  610.   new.block
  611.   format.title "title" output.check
  612.   new.block
  613.   crossref missing$
  614.     { journal emphasize "journal" output.check
  615.       format.vol.num.pages output
  616.       format.date "year" output.check
  617.     }
  618.     { format.article.crossref output.nonnull
  619.       format.pages output
  620.     }
  621.   if$
  622.   new.block
  623.   note output
  624.   dfk.stuff
  625.   fin.entry
  626. }
  627.  
  628. FUNCTION {book}
  629. { output.bibitem
  630.   author empty$
  631.     { format.editors "author and editor" output.check }
  632.     { format.authors output.nonnull
  633.       crossref missing$
  634.     { "author and editor" editor either.or.check }
  635.     'skip$
  636.       if$
  637.     }
  638.   if$
  639.   new.block
  640.   format.btitle "title" output.check
  641.   crossref missing$
  642.     { format.bvolume output
  643.       new.block
  644.       format.number.series output
  645.       new.sentence
  646.       publisher "publisher" output.check
  647.       address output
  648.     }
  649.     { new.block
  650.       format.book.crossref output.nonnull
  651.     }
  652.   if$
  653.   format.edition output
  654.   format.date "year" output.check
  655.   new.block
  656.   note output
  657.   dfk.stuff
  658.   fin.entry
  659. }
  660.  
  661. FUNCTION {booklet}
  662. { output.bibitem
  663.   format.authors output
  664.   new.block
  665.   format.title "title" output.check
  666.   howpublished address new.block.checkb
  667.   howpublished output
  668.   address output
  669.   format.date output
  670.   new.block
  671.   note output
  672.   dfk.stuff
  673.   fin.entry
  674. }
  675.  
  676. FUNCTION {inbook}
  677. { output.bibitem
  678.   author empty$
  679.     { format.editors "author and editor" output.check }
  680.     { format.authors output.nonnull
  681.       crossref missing$
  682.     { "author and editor" editor either.or.check }
  683.     'skip$
  684.       if$
  685.     }
  686.   if$
  687.   new.block
  688.   format.btitle "title" output.check
  689.   crossref missing$
  690.     { format.bvolume output
  691.       format.chapter.pages "chapter and pages" output.check
  692.       new.block
  693.       format.number.series output
  694.       new.sentence
  695.       publisher "publisher" output.check
  696.       address output
  697.     }
  698.     { format.chapter.pages "chapter and pages" output.check
  699.       new.block
  700.       format.book.crossref output.nonnull
  701.     }
  702.   if$
  703.   format.edition output
  704.   format.date "year" output.check
  705.   new.block
  706.   note output
  707.   dfk.stuff
  708.   fin.entry
  709. }
  710.  
  711. FUNCTION {incollection}
  712. { output.bibitem
  713.   format.authors "author" output.check
  714.   new.block
  715.   format.title "title" output.check
  716.   new.block
  717.   crossref missing$
  718.     { format.in.ed.booktitle "booktitle" output.check
  719.       format.bvolume output
  720.       format.number.series output
  721.       format.chapter.pages output
  722.       new.sentence
  723.       publisher "publisher" output.check
  724.       address output
  725.       format.edition output
  726.       format.date "year" output.check
  727.     }
  728.     { format.incoll.inproc.crossref output.nonnull
  729.       format.chapter.pages output
  730.     }
  731.   if$
  732.   new.block
  733.   note output
  734.   dfk.stuff
  735.   fin.entry
  736. }
  737.  
  738. FUNCTION {inproceedings}
  739. { output.bibitem
  740.   format.authors "author" output.check
  741.   new.block
  742.   format.title "title" output.check
  743.   new.block
  744.   crossref missing$
  745.     { format.in.ed.booktitle "booktitle" output.check
  746.       format.bvolume output
  747.       format.number.series output
  748.       format.pages output
  749.       address empty$
  750.     { organization publisher new.sentence.checkb
  751.       organization output
  752.       publisher output
  753.       format.date "year" output.check
  754.     }
  755.     { address output.nonnull
  756.       format.date "year" output.check
  757.       new.sentence
  758.       organization output
  759.       publisher output
  760.     }
  761.       if$
  762.     }
  763.     { format.incoll.inproc.crossref output.nonnull
  764.       format.pages output
  765.     }
  766.   if$
  767.   new.block
  768.   note output
  769.   dfk.stuff
  770.   fin.entry
  771. }
  772.  
  773. FUNCTION {conference} { inproceedings }
  774.  
  775. FUNCTION {manual}
  776. { output.bibitem
  777.   author empty$
  778.     { organization empty$
  779.     'skip$
  780.     { organization output.nonnull
  781.       address output
  782.     }
  783.       if$
  784.     }
  785.     { format.authors output.nonnull }
  786.   if$
  787.   new.block
  788.   format.btitle "title" output.check
  789.   author empty$
  790.     { organization empty$
  791.     { address new.block.checka
  792.       address output
  793.     }
  794.     'skip$
  795.       if$
  796.     }
  797.     { organization address new.block.checkb
  798.       organization output
  799.       address output
  800.     }
  801.   if$
  802.   format.edition output
  803.   format.date output
  804.   new.block
  805.   note output
  806.   dfk.stuff
  807.   fin.entry
  808. }
  809.  
  810. FUNCTION {mastersthesis}
  811. { output.bibitem
  812.   format.authors "author" output.check
  813.   new.block
  814.   format.title "title" output.check
  815.   new.block
  816.   "Master's thesis" format.thesis.type output.nonnull
  817.   school "school" output.check
  818.   address output
  819.   format.date "year" output.check
  820.   new.block
  821.   note output
  822.   dfk.stuff
  823.   fin.entry
  824. }
  825.  
  826. FUNCTION {misc}
  827. { output.bibitem
  828.   format.authors output
  829.   title howpublished new.block.checkb
  830.   format.title output
  831.   howpublished new.block.checka
  832.   howpublished output
  833.   format.date output
  834.   new.block
  835.   note output
  836.   dfk.stuff
  837.   fin.entry
  838.   empty.misc.check
  839. }
  840.  
  841. FUNCTION {phdthesis}
  842. { output.bibitem
  843.   format.authors "author" output.check
  844.   new.block
  845.   format.btitle "title" output.check
  846.   new.block
  847.   "PhD thesis" format.thesis.type output.nonnull
  848.   school "school" output.check
  849.   address output
  850.   format.date "year" output.check
  851.   new.block
  852.   note output
  853.   dfk.stuff
  854.   fin.entry
  855. }
  856.  
  857. FUNCTION {proceedings}
  858. { output.bibitem
  859.   editor empty$
  860.     { organization output }
  861.     { format.editors output.nonnull }
  862.   if$
  863.   new.block
  864.   format.btitle "title" output.check
  865.   format.bvolume output
  866.   format.number.series output
  867.   address empty$
  868.     { editor empty$
  869.     { publisher new.sentence.checka }
  870.     { organization publisher new.sentence.checkb
  871.       organization output
  872.     }
  873.       if$
  874.       publisher output
  875.       format.date "year" output.check
  876.     }
  877.     { address output.nonnull
  878.       format.date "year" output.check
  879.       new.sentence
  880.       editor empty$
  881.     'skip$
  882.     { organization output }
  883.       if$
  884.       publisher output
  885.     }
  886.   if$
  887.   new.block
  888.   note output
  889.   dfk.stuff
  890.   fin.entry
  891. }
  892.  
  893. FUNCTION {techreport}
  894. { output.bibitem
  895.   format.authors "author" output.check
  896.   new.block
  897.   format.title "title" output.check
  898.   new.block
  899.   format.tr.number output.nonnull
  900.   institution "institution" output.check
  901.   address output
  902.   format.date "year" output.check
  903.   new.block
  904.   note output
  905.   dfk.stuff
  906.   fin.entry
  907. }
  908.  
  909. FUNCTION {unpublished}
  910. { output.bibitem
  911.   format.authors "author" output.check
  912.   new.block
  913.   format.title "title" output.check
  914.   new.block
  915.   note "note" output.check
  916.   format.date output
  917.   dfk.stuff
  918.   fin.entry
  919. }
  920.  
  921. FUNCTION {default.type} { misc }
  922.  
  923. MACRO {jan} {"January"}
  924.  
  925. MACRO {feb} {"February"}
  926.  
  927. MACRO {mar} {"March"}
  928.  
  929. MACRO {apr} {"April"}
  930.  
  931. MACRO {may} {"May"}
  932.  
  933. MACRO {jun} {"June"}
  934.  
  935. MACRO {jul} {"July"}
  936.  
  937. MACRO {aug} {"August"}
  938.  
  939. MACRO {sep} {"September"}
  940.  
  941. MACRO {oct} {"October"}
  942.  
  943. MACRO {nov} {"November"}
  944.  
  945. MACRO {dec} {"December"}
  946.  
  947. MACRO {acmcs} {"ACM Computing Surveys"}
  948.  
  949. MACRO {acta} {"Acta Informatica"}
  950.  
  951. MACRO {cacm} {"Communications of the ACM"}
  952.  
  953. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  954.  
  955. MACRO {ibmsj} {"IBM Systems Journal"}
  956.  
  957. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  958.  
  959. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  960.  
  961. MACRO {ieeetcad}
  962.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  963.  
  964. MACRO {ipl} {"Information Processing Letters"}
  965.  
  966. MACRO {jacm} {"Journal of the ACM"}
  967.  
  968. MACRO {jcss} {"Journal of Computer and System Sciences"}
  969.  
  970. MACRO {scp} {"Science of Computer Programming"}
  971.  
  972. MACRO {sicomp} {"SIAM Journal on Computing"}
  973.  
  974. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  975.  
  976. MACRO {tods} {"ACM Transactions on Database Systems"}
  977.  
  978. MACRO {tog} {"ACM Transactions on Graphics"}
  979.  
  980. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  981.  
  982. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  983.  
  984. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  985.  
  986. MACRO {tcs} {"Theoretical Computer Science"}
  987.  
  988. READ
  989.  
  990. FUNCTION {sortify}
  991. { purify$
  992.   "l" change.case$
  993. }
  994.  
  995. INTEGERS { len }
  996.  
  997. FUNCTION {chop.word}
  998. { 's :=
  999.   'len :=
  1000.   s #1 len substring$ =
  1001.     { s len #1 + global.max$ substring$ }
  1002.     's
  1003.   if$
  1004. }
  1005.  
  1006. INTEGERS { et.al.char.used }
  1007.  
  1008. FUNCTION {initialize.et.al.char.used}
  1009. { #0 'et.al.char.used :=
  1010. }
  1011.  
  1012. EXECUTE {initialize.et.al.char.used}
  1013.  
  1014. FUNCTION {format.lab.names}
  1015. { 's :=
  1016.   s num.names$ 'numnames :=
  1017.   numnames #1 >
  1018.     { numnames #4 >
  1019.     { #3 'namesleft := }
  1020.     { numnames 'namesleft := }
  1021.       if$
  1022.       #1 'nameptr :=
  1023.       ""
  1024.     { namesleft #0 > }
  1025.     { nameptr numnames =
  1026.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1027.         { "{\etalchar{+}}" *
  1028.           #1 'et.al.char.used :=
  1029.         }
  1030.         { s nameptr "{v{}}{l{}}" format.name$ * }
  1031.           if$
  1032.         }
  1033.         { s nameptr "{v{}}{l{}}" format.name$ * }
  1034.       if$
  1035.       nameptr #1 + 'nameptr :=
  1036.       namesleft #1 - 'namesleft :=
  1037.     }
  1038.       while$
  1039.       numnames #4 >
  1040.     { "{\etalchar{+}}" *
  1041.       #1 'et.al.char.used :=
  1042.     }
  1043.     'skip$
  1044.       if$
  1045.     }
  1046.     { s #1 "{v{}}{l{}}" format.name$
  1047.       duplicate$ text.length$ #2 <
  1048.     { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  1049.     'skip$
  1050.       if$
  1051.     }
  1052.   if$
  1053. }
  1054.  
  1055. FUNCTION {author.key.label}
  1056. { author empty$
  1057.     { key empty$
  1058.     { cite$ #1 #3 substring$ }
  1059.     { key #3 text.prefix$ }
  1060.       if$
  1061.     }
  1062.     { author format.lab.names }
  1063.   if$
  1064. }
  1065.  
  1066. FUNCTION {author.editor.key.label}
  1067. { author empty$
  1068.     { editor empty$
  1069.     { key empty$
  1070.         { cite$ #1 #3 substring$ }
  1071.         { key #3 text.prefix$ }
  1072.       if$
  1073.     }
  1074.     { editor format.lab.names }
  1075.       if$
  1076.     }
  1077.     { author format.lab.names }
  1078.   if$
  1079. }
  1080.  
  1081. FUNCTION {author.key.organization.label}
  1082. { author empty$
  1083.     { key empty$
  1084.     { organization empty$
  1085.         { cite$ #1 #3 substring$ }
  1086.         { "The " #4 organization chop.word #3 text.prefix$ }
  1087.       if$
  1088.     }
  1089.     { key #3 text.prefix$ }
  1090.       if$
  1091.     }
  1092.     { author format.lab.names }
  1093.   if$
  1094. }
  1095.  
  1096. FUNCTION {editor.key.organization.label}
  1097. { editor empty$
  1098.     { key empty$
  1099.     { organization empty$
  1100.         { cite$ #1 #3 substring$ }
  1101.         { "The " #4 organization chop.word #3 text.prefix$ }
  1102.       if$
  1103.     }
  1104.     { key #3 text.prefix$ }
  1105.       if$
  1106.     }
  1107.     { editor format.lab.names }
  1108.   if$
  1109. }
  1110.  
  1111. FUNCTION {calc.label}
  1112. { type$ "book" =
  1113.   type$ "inbook" =
  1114.   or
  1115.     'author.editor.key.label
  1116.     { type$ "proceedings" =
  1117.     'editor.key.organization.label
  1118.     { type$ "manual" =
  1119.         'author.key.organization.label
  1120.         'author.key.label
  1121.       if$
  1122.     }
  1123.       if$
  1124.     }
  1125.   if$
  1126.   duplicate$
  1127.   year field.or.null purify$ #-1 #2 substring$
  1128.   *
  1129.   'label :=
  1130.   year field.or.null purify$ #-1 #4 substring$
  1131.   *
  1132.   sortify 'sort.label :=
  1133. }
  1134.  
  1135. FUNCTION {sort.format.names}
  1136. { 's :=
  1137.   #1 'nameptr :=
  1138.   ""
  1139.   s num.names$ 'numnames :=
  1140.   numnames 'namesleft :=
  1141.     { namesleft #0 > }
  1142.     { nameptr #1 >
  1143.     { "   " * }
  1144.     'skip$
  1145.       if$
  1146.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1147.       nameptr numnames = t "others" = and
  1148.     { "et al" * }
  1149.     { t sortify * }
  1150.       if$
  1151.       nameptr #1 + 'nameptr :=
  1152.       namesleft #1 - 'namesleft :=
  1153.     }
  1154.   while$
  1155. }
  1156.  
  1157. FUNCTION {sort.format.title}
  1158. { 't :=
  1159.   "A " #2
  1160.     "An " #3
  1161.       "The " #4 t chop.word
  1162.     chop.word
  1163.   chop.word
  1164.   sortify
  1165.   #1 global.max$ substring$
  1166. }
  1167.  
  1168. FUNCTION {author.sort}
  1169. { author empty$
  1170.     { key empty$
  1171.     { "to sort, need author or key in " cite$ * warning$
  1172.       ""
  1173.     }
  1174.     { key sortify }
  1175.       if$
  1176.     }
  1177.     { author sort.format.names }
  1178.   if$
  1179. }
  1180.  
  1181. FUNCTION {author.editor.sort}
  1182. { author empty$
  1183.     { editor empty$
  1184.     { key empty$
  1185.         { "to sort, need author, editor, or key in " cite$ * warning$
  1186.           ""
  1187.         }
  1188.         { key sortify }
  1189.       if$
  1190.     }
  1191.     { editor sort.format.names }
  1192.       if$
  1193.     }
  1194.     { author sort.format.names }
  1195.   if$
  1196. }
  1197.  
  1198. FUNCTION {author.organization.sort}
  1199. { author empty$
  1200.     { organization empty$
  1201.     { key empty$
  1202.         { "to sort, need author, organization, or key in " cite$ * warning$
  1203.           ""
  1204.         }
  1205.         { key sortify }
  1206.       if$
  1207.     }
  1208.     { "The " #4 organization chop.word sortify }
  1209.       if$
  1210.     }
  1211.     { author sort.format.names }
  1212.   if$
  1213. }
  1214.  
  1215. FUNCTION {editor.organization.sort}
  1216. { editor empty$
  1217.     { organization empty$
  1218.     { key empty$
  1219.         { "to sort, need editor, organization, or key in " cite$ * warning$
  1220.           ""
  1221.         }
  1222.         { key sortify }
  1223.       if$
  1224.     }
  1225.     { "The " #4 organization chop.word sortify }
  1226.       if$
  1227.     }
  1228.     { editor sort.format.names }
  1229.   if$
  1230. }
  1231.  
  1232. FUNCTION {presort}
  1233. { calc.label
  1234.   sort.label
  1235.   "    "
  1236.   *
  1237.   type$ "book" =
  1238.   type$ "inbook" =
  1239.   or
  1240.     'author.editor.sort
  1241.     { type$ "proceedings" =
  1242.     'editor.organization.sort
  1243.     { type$ "manual" =
  1244.         'author.organization.sort
  1245.         'author.sort
  1246.       if$
  1247.     }
  1248.       if$
  1249.     }
  1250.   if$
  1251.   *
  1252.   "    "
  1253.   *
  1254.   year field.or.null sortify
  1255.   *
  1256.   "    "
  1257.   *
  1258.   title field.or.null
  1259.   sort.format.title
  1260.   *
  1261. % DFK throw away stuff above and use cite$ for sort key
  1262.   pop$
  1263.   cite$
  1264.   #1 entry.max$ substring$
  1265.   'sort.key$ :=
  1266. }
  1267.  
  1268. ITERATE {presort}
  1269.  
  1270. SORT
  1271.  
  1272. STRINGS { longest.label last.sort.label next.extra }
  1273.  
  1274. INTEGERS { longest.label.width last.extra.num }
  1275.  
  1276. FUNCTION {initialize.longest.label}
  1277. { "" 'longest.label :=
  1278.   #0 int.to.chr$ 'last.sort.label :=
  1279.   "" 'next.extra :=
  1280.   #0 'longest.label.width :=
  1281.   #0 'last.extra.num :=
  1282. }
  1283.  
  1284. FUNCTION {forward.pass}
  1285. { last.sort.label sort.label =
  1286.     { last.extra.num #1 + 'last.extra.num :=
  1287.       last.extra.num int.to.chr$ 'extra.label :=
  1288.     }
  1289.     { "a" chr.to.int$ 'last.extra.num :=
  1290.       "" 'extra.label :=
  1291.       sort.label 'last.sort.label :=
  1292.     }
  1293.   if$
  1294. }
  1295.  
  1296. FUNCTION {reverse.pass}
  1297. { next.extra "b" =
  1298.     { "a" 'extra.label := }
  1299.     'skip$
  1300.   if$
  1301.   label extra.label * 'label :=
  1302.   label width$ longest.label.width >
  1303.     { label 'longest.label :=
  1304.       label width$ 'longest.label.width :=
  1305.     }
  1306.     'skip$
  1307.   if$
  1308.   extra.label 'next.extra :=
  1309. }
  1310.  
  1311. EXECUTE {initialize.longest.label}
  1312.  
  1313. ITERATE {forward.pass}
  1314.  
  1315. REVERSE {reverse.pass}
  1316.  
  1317. FUNCTION {begin.bib}
  1318. { et.al.char.used
  1319.     { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1320.     'skip$
  1321.   if$
  1322.   preamble$ empty$
  1323.     'skip$
  1324.     { preamble$ write$ newline$ }
  1325.   if$
  1326.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1327. }
  1328.  
  1329. EXECUTE {begin.bib}
  1330.  
  1331. EXECUTE {init.state.consts}
  1332.  
  1333. ITERATE {call.type$}
  1334.  
  1335. FUNCTION {end.bib}
  1336. { newline$
  1337.   "\end{thebibliography}" write$ newline$
  1338. }
  1339.  
  1340. EXECUTE {end.bib}
  1341.